/** 
 * Mise en oeuvre de Piece.h
 *
 * @file Piece.cxx
 */

#include <iostream>
// A besoin de la declaration de la classe
#include "Piece.h"

using namespace std;

Piece::Piece()
{
	cout << "Piece construite" << endl;
}

Piece::Piece(int x, int y, bool white)
{
	m_x=x;
	m_y=y;
	m_white=white;
	cout << "construction piece reussie" << endl;
}

void
Piece::init( int x, int y, bool white )
{
  m_x = x;
  m_y = y;
  m_white = white;
}

void
Piece::move( int x, int y )
{
  m_x = x;
  m_y = y;
}

void
Piece::setColor(bool white)
{
  m_white=white;
}

void
Piece::afficher()
{
	cout << "Piece: position x = " << m_x << "  position y = " << m_y << (m_white ? "  blanche" : "  noire" ) << endl;
}

int
Piece::getX()
{
  return m_x;
}

int
Piece::getY()
{
  return m_y;
}

bool
Piece::isWhite()
{
  return m_white;
}

bool
Piece::collision(Piece p){
	return ((p.getX()==m_x) && (p.getY()==m_y));
}

Piece
Piece::plusfort(const Piece & p){
	if(m_x==m_y){
                return p;
	}else{
		return *this;
	}

}

Piece::~Piece()
{
	cout << "Piece detruite" << endl;
}
